package org.example.seckilljava.exception;

import lombok.Getter;
import org.example.seckilljava.common.ResponseEnum;

/**
 * 自定义异常类
 *
 */
@Getter
public class BusinessException extends RuntimeException {

    /**
     * 错误码
     */
    private final int code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ResponseEnum responseEnum) {
        super(responseEnum.message());
        this.code = responseEnum.code();
    }

}
